package com.spring.cloud.examples.controller;

import com.spring.cloud.examples.feign.Product1Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

@Controller
@RequestMapping("/seata")
public class SeataController {

    @Autowired
    private RestTemplate restTemplate;


    @Autowired
    private Product1Api product1Api;

    @RequestMapping("/transactional")
    @ResponseBody
    public String testTransactional()
    {
        //在service1里面调用service2 进行全局事务
        String result =product1Api.insertService1();

        return "测试全局事务";
    }
}
